include(../public.cmake)

project(JXQIO)

project_version_conf()

#-----------------------------------------------------------------------------------

include_directories(
	. memory bus fs process
	../JXQCore
	../JXQCore/meta
	../JXQCore/container
	../JXQCore/concurrent
	../../include)

set(HEADER_LIST
	jabstractio.h
	jionotifier.h
	memory/jdatastream.h
	memory/jbuffer.h
	bus/jbus.h
	bus/jserialport.h
	fs/jfiledevice.h
	fs/jfile.h
	fs/jdir.h
	process/jprocess.h
	process/jcprocesswatcher.h
	process/jprocessqueue.h
	process/jsharedmemory.h
	process/jsemaphore.h
	)

set(PRIVATE_HEADER_LIST
	jabstractio_p.h
	jionotifier_p.h
	fs/jfiledevice_p.h
	process/jprocess_p.h
	process/jcprocesswatcher_p.h
	process/jsharedmemory_p.h
	process/jsemaphore_p.h
	)

list(APPEND SRC_LIST
	jabstractio.cpp
	jionotifier.cpp
	memory/jdatastream.cpp
	memory/jbuffer.cpp
	bus/jbus.cpp
	bus/jserialport.cpp
	fs/jfiledevice.cpp
	fs/jfile.cpp
	fs/jdir.cpp
	process/jprocess.cpp
	process/jcprocesswatcher.cpp
	process/jprocessqueue.cpp
	process/jsharedmemory.cpp
	process/jsemaphore.cpp
	)

#-----------------------------------------------------------------------------------

if(WIN32)
	list(APPEND SRC_LIST
		jabstractio_win.cpp
		jionotifier_win.cpp
		bus/jserialport_win.cpp
		fs/jdir_win.cpp
		fs/jfiledevice_win.cpp
		process/jprocess_win.cpp
		process/jcprocesswatcher_win.cpp
		process/jsharedmemory_win.cpp
		process/jsemaphore_win.cpp
		)
elseif(UNIX)
	list(APPEND HEADER_LIST
		process/jposixmessagequeue.h
		)
	list(APPEND SRC_LIST
		jabstractio_unix.cpp
		jionotifier_unix.cpp
		bus/jserialport_unix.cpp
		fs/jdir_unix.cpp
		fs/jfiledevice_unix.cpp
		process/jprocess_unix.cpp
		process/jcprocesswatcher_unix.cpp
		process/jsharedmemory_unix.cpp
		process/jsemaphore_unix.cpp
		process/jposixmessagequeue.cpp
		)
endif()

#-----------------------------------------------------------------------------------

FILE(GLOB_RECURSE G_HEADER_LIST ../../include/JXQIO/*)

add_library(${PROJECT_NAME} SHARED
	${SRC_LIST}
	${HEADER_LIST}
	${PRIVATE_HEADER_LIST}
	${G_HEADER_LIST}
	${VERSIONINFO_RC}
)

target_link_libraries(${PROJECT_NAME} PRIVATE JXQCore)

#-----------------------------------------------------------------------------------

output_conf()

file(COPY ${HEADER_LIST} ${HEADER_LIST_PLTFM} DESTINATION
	${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/include/JXQIO)

